# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Calculator.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 6;
BEGIN { use_ok('Calculator');
        use_ok('Calculator::PostfixCalc');
};

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.


my $input = '1+2';
my $expected = '1 2 +';
my $tree = parse($input);
is($tree->ceval(),$expected,"suma");


$input = '{a=1;a=a}';
$expected = '1 a = ; a a =';
$tree = parse($input);
is($tree->ceval(),$expected,"asignacion y uso");

$input = 'if 1 then 2';
$expected = '1 jz else1 2 :else1 ';
$tree = parse($input);
is($tree->ceval(),$expected,"if sin else");

$input = 'if 1 then 2 else 3';
$expected = '1 jz else2 2 j endif3 :else2 3 :endif3 ';
$tree = parse($input);
is($tree->ceval(),$expected,"if con else");

